"""
增加序列化
"""

import math
import pickle


class Shape:
    def __init__(self, x=1, y=1, z=1, r=1):
        """

        :param x: 长
        :param y: 宽
        :param z: 高
        :param r: 半径
        """
        self.length = x
        self.width = y
        self.height = z
        self.radius = r

    def area(self):
        pass


class Triangle(Shape):

    def area(self):
        return self.length * self.width / 2


class Rectangle(Shape):

    def area(self):
        return self.length * self.width


class Circular(Shape):

    def area(self):
        return math.pi * pow(self.radius, 2)

    def serialzation(self):
        f = pickle.dumps(self.area())
        return f


area01 = Circular(r=5)

print(area01.__dict__)
print(area01.area())
print(area01.serialzation())
